package cn.xy.base.server.dto;

import cn.hutool.core.bean.BeanUtil;
import cn.xy.base.server.po.SysAdmin;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;

/**
 * 表[sys_admin]对应AddDTO类
 *
 * @author auto
 */

@Data
public class SysAdminAddDTO {

    /**
     * 角色ID
     */
    @Min(value = 1, message = "请选择角色")
    @ApiModelProperty(value = "角色ID", dataType = "int")
    private int roleId;

    /**
     * 用户账号
     */
    @NotEmpty(message = "用户账号不能为空")
    @ApiModelProperty(value = "用户账号", dataType = "String")
    private String username;

    /**
     * 用户昵称
     */
    @ApiModelProperty(value = "用户昵称", dataType = "String")
    private String nickname;

    /**
     * 密码
     */
    @NotEmpty(message = "密码不能为空")
    @ApiModelProperty(value = "密码", dataType = "String")
    private String password;

    /**
     * 头像地址
     */
    @ApiModelProperty(value = "头像地址", dataType = "String")
    private String avatar;

    /**
     * 手机号码
     */
    @ApiModelProperty(value = "手机号码", dataType = "String")
    private String mobile;

    /**
     * 用户邮箱
     */
    @ApiModelProperty(value = "用户邮箱", dataType = "String")
    private String email;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注", dataType = "String")
    private String remark;

    /**
     * 乡村id列表
     */
    @ApiModelProperty(value = "乡村id列表", dataType = "int")
    private Integer rusticId;

    public SysAdmin toSysAdmin() {
        SysAdmin sysAdmin = new SysAdmin();
        BeanUtil.copyProperties(this, sysAdmin);
        return sysAdmin;
    }
}
